package com.entrogy.dao;

import com.entrogy.bean.*;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @ClassName FinalServiceMapper
 * @Description
 * @Author luoxingjiang
 * @Date 2019-12-18 上午 10:13
 * @Version 1.0
 **/
@Repository
public interface FinalNoticeMapper {

    /**
     * 查询评语模板
     * @param schoolCode
     * @param finalNoticeCommentTempId
     * @param uid
     * @return
     */
    List<FinalNoticeCommentTemplateEntity> listComment(@Param("schoolCode") Integer schoolCode, @Param("finalNoticeCommentTempId") Integer finalNoticeCommentTempId, @Param("uid") String uid);

    /**
     * 查询通知书内容
     * @param finalNoticeId
     * @return
     */
    FinalNoticeEntity getFinalNotice(@Param("finalNoticeId") Integer finalNoticeId);

    /**
     * 教师评价学生
     * @param teacherComment
     * @return
     */
    int insertStudentTeacherComment(FinalNoticeTeacherCommentEntity teacherComment);

    /**
     * 更新学生的通知书
     * @param finalNotice
     * @return
     */
    int updateStudentFinalNotice(FinalNoticeEntity finalNotice);

    /**
     * 查询已经下发了通知书的学生列表
     * @param schoolCode
     * @param gradeId
     * @param term
     * @param termOfYear
     * @param studentName
     * @param studentIdList
     * @return
     */
    List<StudentBasicInfoEntity> listStudentForFinalNotice(@Param("schoolCode") Integer schoolCode, @Param("gradeId") Integer gradeId, @Param("term") String term, @Param("termOfYear") String termOfYear, @Param("studentName") String studentName, @Param("studentIdList") List<Integer> studentIdList);

    /**
     * 查询通知书内容
     * @param schoolCode
     * @param finalNoticeContentId
     * @param term
     * @param termOfYear
     * @param gradeId
     * @param deleteStatus
     * @return
     */
    List<FinalNoticeContentEntity> listFinalNoticeContent(@Param("schoolCode") Integer schoolCode, @Param("finalNoticeContentId") Integer finalNoticeContentId, @Param("term") String term, @Param("termOfYear") String termOfYear, @Param("gradeId") Integer gradeId, @Param("deleteStatus") Integer deleteStatus);

    /**
     * 查询学生评语内容
     * @param studentId
     * @param term
     * @param termOfYear
     * @param finalNoticeTeacherCommentId
     * @return
     */
    FinalNoticeTeacherCommentEntity getStudentComment(@Param("studentId") Integer studentId, @Param("term") String term, @Param("termOfYear") String termOfYear, @Param("finalNoticeTeacherCommentId") Integer finalNoticeTeacherCommentId);

    /**
     * 更新学生评语
     * @param teacherCommentId
     * @param commentTemplateId
     * @return
     */
    int updateStudentTeacherComment(@Param("teacherCommentId") Integer teacherCommentId, @Param("commentTemplateId") Integer commentTemplateId);

    /**
     * 插入学生通知书
     * @param finalNoticeList
     * @return
     */
    int insertStudentFinalNotice(@Param("finalNoticeList") List<FinalNoticeEntity> finalNoticeList);

    /**
     * 更新通知书内容模板
     * @param finalNoticeContent
     * @return
     */
    int updateFinalNoticeContent(FinalNoticeContentEntity finalNoticeContent);

    /**
     * 新增通知书内容模板
     * @param finalNoticeContent
     * @return
     */
    int insertFinalNoticeContent(FinalNoticeContentEntity finalNoticeContent);

    /**
     * 查询通知书
     * @param schoolCode
     * @param gradeId
     * @param classId
     * @param studentId
     * @param studentName
     * @return
     */
    List<StudentBasicInfoEntity> listStudent(@Param("schoolCode") Integer schoolCode, @Param("gradeId") Integer gradeId, @Param("classId") Integer classId, @Param("studentId") Integer studentId, @Param("studentName") String studentName);

    /**
     * 统计通知书条数
     * @param term
     * @param termOfYear
     * @param gradeId
     * @param schoolCode
     * @return
     */
    Integer countFinalNotice(@Param("term") String term, @Param("termOfYear") String termOfYear, @Param("gradeId") Integer gradeId, @Param("schoolCode") Integer schoolCode);

    /**
     * 删除该学年该学期该年级的通知书记录
     * @param term
     * @param termOfYear
     * @param gradeId
     * @param schoolCode
     * @return
     */
    int deleteFinalNotice(@Param("term") String term, @Param("termOfYear") String termOfYear, @Param("gradeId") Integer gradeId, @Param("schoolCode") Integer schoolCode);

    /**
     * 查询期末成绩&评语
     * @param examId
     * @param gradeId
     * @param scoreTableName
     * @return
     */
    List<StudentScoreEntity> listStudentFinalExamScore(@Param("examId") Integer examId, @Param("gradeId") Integer gradeId, @Param("scoreTableName") String scoreTableName);

    /**
     * 新增评语列表
     * @param finalNoticeCommentTemplate
     * @return
     */
    Integer insertComment(FinalNoticeCommentTemplateEntity finalNoticeCommentTemplate);
}
